Added Functions: isPrime, sumAll, Naive Search#141
Open
chs-mix wants to merge 17 commits intomanrajgrover:masterfrom
Open
Added Functions: isPrime, sumAll, Naive Search#141chs-mix wants to merge 17 commits intomanrajgrover:masterfrom
chs-mix wants to merge 17 commits intomanrajgrover:masterfrom
Conversation
Added Functions: Sum All, Naive Search, Is Prime
fixed for erros
fixed errors
fixed errors
fixed tests
MdialloC19
reviewed
Dec 29, 2023
| * References: https://javascript.plainenglish.io/11-mathematical-algorithms-in-modern-javascript-bce71318e2da | ||
| */ | ||
| const isprime = (num) => { | ||
| const limit = Math.floor(Math.sqrt(num)); |
There was a problem hiding this comment.
before this you have to verify if the number are greater or equal to 1 or if is a integer
if (num <= 1 || !Number.isInteger(num)) {
return false;
}
MdialloC19
reviewed
Dec 29, 2023
| const isprime = require('../../../src').algorithms.math.isprime; | ||
|
|
||
| const assert = require('assert'); | ||
|
|
There was a problem hiding this comment.
put testing for negative number and float
MdialloC19
reviewed
Dec 29, 2023
| * Calculates the sum of all numbers in an array | ||
| * @param {Array} arr of two ints where arr[0] start, arr[1] end | ||
| * @return {Number} sum sum of the range of numberse | ||
| */ |
There was a problem hiding this comment.
here the wanted function and you implement is different
MdialloC19
suggested changes
Dec 29, 2023
MdialloC19
left a comment
There was a problem hiding this comment.
Please make change on isPrime and sumAll (use camel case). And review your testing value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of new feature, or changes
Three functions were created one under the search directory (naive_search) and two under the sum directory (is_prime and sum_all). The index.js in each directory was also edited to include new functions. Three tests were also implemented for the respective functions.
Checklist
Related Issues and Discussions
People to notify